package com.sxkj.web.controller.version;

import com.sxkj.common.response.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import com.github.pagehelper.PageInfo;
import com.sxkj.entity.entity.version.VersionFile;
import com.sxkj.service.version.VersionFileService;

/**
 * @author Zhang Xingliang
 *
 * @description: 秤更新包文件
 * @date 2019-12-31 13:25:41
 */
@RestController
@RequestMapping("/version/versionFile")
public class VersionFileController {

	/*@Autowired
	private VersionFileService versionFileService;

	@ApiOperation(value = "根据主键查秤更新包文件信息")
	@GetMapping(value = "/get/{id}")
	public ResponseResult get(@PathVariable String id) {
		try {
			VersionFile versionFile = versionFileService.get(id);
			return ResponseResult.success(versionFile);
		} catch (Exception e) {
			return ResponseResult.failure(e.toString());
		}
	}

	@ApiOperation(value = "新增秤更新包文件信息")
	@RequestMapping(value = "/save", method = RequestMethod.POST)
	public ResponseResult save(@RequestBody VersionFile versionFile) {
		try {
			versionFileService.save(versionFile);
			return ResponseResult.success();
		} catch (Exception e) {
			return ResponseResult.failure(e.toString());
		}
	}

	@ApiOperation(value = "删除秤更新包文件信息")
	@RequestMapping(value = "/delete", method = RequestMethod.POST)
	public ResponseResult delete(@RequestBody VersionFile versionFile) {
		try {
			versionFileService.delete(versionFile);
			return ResponseResult.success();
		} catch (Exception e) {
			return ResponseResult.failure(e.toString());
		}
	}

	@ApiOperation(value = "查询秤更新包文件列表")
	@RequestMapping(value = "/findList", method = RequestMethod.POST)
	public ResponseResult findList(@RequestBody VersionFile versionFile) {
		try {
			return ResponseResult.success(versionFileService.findList(versionFile));
		} catch (Exception e) {
			return ResponseResult.failure(e.toString());
		}
	}

	@ApiOperation(value = "查询秤更新包文件列表")
	@RequestMapping(value = "/findPage", method = RequestMethod.POST)
	public ResponseResult findPage(@RequestBody VersionFile versionFile,
			@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
			@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
		try {
			PageInfo pageInfo = versionFileService.findPage(versionFile, pageSize, pageNum);
			return ResponseResult.success(pageInfo);
		} catch (Exception e) {
			return ResponseResult.failure(e.toString());
		}
	}*/

}
